Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

screenfull

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

screenfull

Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.

  • 5.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is screenfull?

The screenfull npm package is a simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which allows web pages to display web content in full-screen mode, exiting this mode, and toggling between these states. It abstracts away the differences between various browsers' implementations of the Fullscreen API, providing a consistent and easy-to-use interface for developers.

What are screenfull's main functionalities?

Toggle Fullscreen

This feature allows you to toggle fullscreen mode on and off for the page or a specific element. The code checks if fullscreen is supported and enabled, then toggles the fullscreen state.

if (screenfull.isEnabled) {
  screenfull.toggle();
}

Enter Fullscreen

This feature enables entering fullscreen mode. The code sample demonstrates how to request the browser to enter fullscreen mode if it is supported.

if (screenfull.isEnabled) {
  screenfull.request();
}

Exit Fullscreen

This feature allows you to exit fullscreen mode programmatically. The code checks if fullscreen is enabled and then exits fullscreen mode.

if (screenfull.isEnabled) {
  screenfull.exit();
}

Fullscreen Change Event

This feature allows you to listen for changes in the fullscreen state. The code sample demonstrates how to register an event listener that logs the current fullscreen state whenever it changes.

if (screenfull.isEnabled) {
  screenfull.on('change', () => {
    console.log('Am I fullscreen?', screenfull.isFullscreen ? 'Yes' : 'No');
  });
}

Other packages similar to screenfull

Keywords

FAQs

Package last updated on 03 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc